package homework.api.day07;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class WriterDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("os.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        osw.write("无意苦争春,一任群芳妒。");
        osw.close();

        FileInputStream fis = new FileInputStream("os.txt");
        InputStreamReader isr = new InputStreamReader(fis,StandardCharsets.UTF_8);
        int d;
        while((d=isr.read())!=-1){
            System.out.print((char)d);
        }
        isr.close();

    }
}
